package com.hq.common.domain;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;

/**

 * @since 2015-01-26 23:18
 */
public class Result implements Serializable {
    private Map<String,Object> data=new LinkedHashMap<String,Object>();
    private ResultCode code = ResultCode.OK;
    private String url;
    private String message;

    public Result() {
    }

    public Result(ResultCode code, Map data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public Result(ResultCode code,String url, Map data, String message) {
        this.code = code;
        this.data = data;
        this.url=url;
        this.message = message;
    }


    public Result(String url) {
        this.url=url;
    }

    public Result(String url, String message) {
        this.url=url;
        this.message = message;
    }

    public Result(ResultCode code,String url, String message) {
        this.code = code;
        this.url=url;
        this.message = message;
    }

    public Result(ResultCode code, String message) {
        this.code = code;
        this.message = message;
    }



    public Result addData(String key,Object value){
        this.data.put(key,value);
        return this;
    }


    public Result addAllData(Map<String,Object> map){
        this.data.putAll(map);
        return this;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public int getCode() {
        return code.getCode();
    }

    public void setCode(ResultCode code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
}
